﻿using System;

namespace Pisces
{
	/// <summary>
	/// 网络消息回调模块
	/// created by wangqiang
	/// </summary>
	public class TcpEventModule : EventModule<TcpEventModule, short>
	{
		public void trigger<T>(short eventID, T t)
		{
			if (!eventMap.TryGetValue(eventID, out delegateCache))
			{
				return;
			}

			try
			{
				// ((Action<T>)delegateCache)((T)t);
				if (delegateCache != null)
				{
					delegateCache.DynamicInvoke(t);
				}
			}
			catch (Exception e)
			{
				PiscesLog.error($"事件:{eventID} 回调方法异常:{e.Message}\n堆栈:{e.StackTrace}");
			}
		}
	}
	
}